<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html> 
<head>
<%@ include file="../../../include/easyui.jsp" %>
<%@ include file="../../../include/pGrid.jsp" %>
<script type="text/javascript" src="/plug-in/jquery-easyui-1.5.1/datagrid-detailview.js"></script>
<title>流程部署管理</title>
<script>
	$(function(){
		/*列表初始化*/
		var gridParam = {
			url :'/console/activiti/deploy/list',
			columns : [ [ 
			    {field: 'id', title: 'ID', width: 120}
		    	,{field: 'name', title: '流程名称', width: '50%'}
		    	,{field: 'deploymentTime', title: '发布时间', width: 150}
			]],
			view: detailview,
			detailFormatter:function(index,row){
				return '<div class="details" style="padding:5px 0;min-height:200px;"></div>';
			},
			onExpandRow:function(index,row){
				var ddv = $(this).datagrid('getRowDetail',index).find('div.details');
				var detailGrid = ddv.datagrid({
					url : '/console/activiti/processDefinition/list?deploymentId='+ row.id,
					title:'流程定义列表-'+ row.name,
					rownumbers: true,
					pagination: true,
					singleSelect: true, 
					columns : [[
							{field : 'id',width : 120,title : 'ID'}
							,{field : 'name',width : 120,title : '流程名称'}
							,{field : 'key',width : 120,title : '流程Key'}
					    	,{field: 'version', title: '流程版本', width: 100}
					    	,{field: 'description', title: '流程描述', width: 120}
						    ,{field: 'resourceName', title: '流程规则文件', width: 120} 
					    	,{field: 'diagramResourceName', title: '流程图片', width: 150,formatter:function(value,row,index){
						    	return '<a target="_blank" href="/console/activiti/processDefinition/imageView?deploymentId='+ row.deploymentId+'&imageName='+row.diagramResourceName +'" >'+ value+'</a>';
						    }}
					    	,{field: 'deploymentId', title: '部署ID', width: 150}
					]],
					onLoadSuccess:function(){
						$('#dataGrid').datagrid('fixDetailRowHeight',index);
					}
				});
			},
		};
		p.dataGrid = $(p.dataGrid).datagrid( $.extend({}, p.dataGridParam, gridParam));

		/*事件响应*/
		$("#toolbar .easyui-linkbutton").on("click", function() {
			var id = $(this).attr("motion_code");
			switch (id) {
				case "03":
					p.gridDelete({ msg:"此操作将删除与此流程定义相关所有信息，确定删除？" ,url:'/console/activiti/deploy/delete'});
					break;
				case "05":
					p.gridQuery();
					break;
				case "07":
					p.down({filename:'部署管理'});
					break;
				case "19":
					p.gridAdd({href:'/console/activiti/deploy/', title : "流程部署文件导入", width : 550, height : 320 });
					break;
				default:
					break;
			}
		});
	});
</script>
</head>
<body  class="easyui-layout">
		<!-- 但行高度33px，多行时 33乘以行数  -->
		<div id="querybar" data-options="region:'north',split:false,border:false" style="height:33px;">
			<div class="easyui-panel" data-options="fit:true,border:false">
				<!-- 查询条件表单，根据配置进行替换  -->
				<form id="queryForm" >
				 <input type="hidden" name="className" value="com.fs.base.pojo.Log" />
				 <div style="margin-top:5px;margin-left:10px;float:left;">
				  	<input class="easyui-textbox" name="name" style="width:240px;" data-options="label:'流程名称:',required:false" />
					<input type="hidden" name="name_searchType" value="like" />
				 </div>
				</form>
			</div>
		</div>  
	
		<!-- 工具栏按钮 -->
		<div id="toolbar" class="easyui-panel" style="padding:3px;"></div>
		
		<!-- 表格 -->
		<div region="center" border="false">
			<table id="dataGrid"></table>
		</div>
</body>
</html>